package lista1;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

public class ZamianaTest
{
	Zamiana z = null;
	
    @Before
	public void init() 
	{
		z = new Zamiana();
	}
    @After
	public void destroy()
	{
		z = null;
	}
    /*Metoda testujaca przypisanie referencji*/
	@Test
	public void notNullTest()
	{
		assertNotNull(z);
	}
    @Test
	public void binary() throws Exception
	{
		String r = z.convert(10, 5);
		assertEquals("1010", r);
	}
    @Test(timeout=100)
	public void triary() throws Exception
	{
		String r = z.convert(10, 3);
		assertTrue(r.equals("101"));
	}
    @Test(timeout=100)
	public void octany() throws Exception
	{
		String r = z.convert(10, 8);
		assertFalse(!r.equals("12"));
	}
    @Ignore
	public void hexany() throws Exception
	{
		String r = z.convert(15, 16);
		assertEquals("f", r);
	}
    @Test(expected=Exception.class)
	public void error1() throws Exception
	{
		String r = z.convert(10, 1);
		assertSame("",r);	
	}
    @Test(expected=Exception.class)
	public void error100() throws Exception
	{
		String r = z.convert(10, 100);
		assertNotNull(r);
	}

}
